package fuck;

import java.lang.reflect.Method;

public class Test3 {
    public static void main(String[] args) throws Exception {
        // method1();
        //    method2();
        Class clazz = Class.forName("fuck.Student");
        Method method = clazz.getMethod("function4", String.class);
        Student student = (Student) clazz.newInstance();
        Object result = method.invoke(student, "张三");
        System.out.println(result);

    }

    private static void method2() throws ClassNotFoundException, NoSuchMethodException {
        Class clazz = Class.forName("fuck.Student");
        Method show = clazz.getDeclaredMethod("show");
        System.out.println(show);
    }

    private static void method1() throws ClassNotFoundException, NoSuchMethodException {
        Class clazz = Class.forName("fuck.Student");
        Method function = clazz.getMethod("function2", String.class);
        System.out.println(function);
    }
}
